home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJLSR106.ARJ / ONEXIT.C < prev    next >
C/C++ Source or Header  |  1992-03-22  |  859b  |  32 lines

  1. /*
  2. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  3. **
  4. ** This file is distributed under the terms listed in the document
  5. ** "copying.dj", available from DJ Delorie at the address above.
  6. ** A copy of "copying.dj" should accompany this file; if not, a copy
  7. ** should be available from where this file was obtained.  This file
  8. ** may not be distributed without a verbatim copy of "copying.dj".
  9. **
  10. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  11. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. */
  13.  
  14. #include <atexit.h>
  15.  
  16. struct atexit *__atexit = 0;
  17.  
  18. on_exit(func,arg)
  19. void (*func)(int);
  20. int arg;
  21. {
  22.   struct atexit *a = (struct atexit *)malloc(sizeof(struct atexit));
  23.   a->next = __atexit;
  24.   a->function = func;
  25.   a->arg = arg;
  26. }
  27.  
  28. atexit(a)
  29. {
  30.   on_exit(a,0);
  31. }
  32.